<template>
  <keep-alive>
    <System v-if="!isAdminRoute" />
    <Admin v-else />
  </keep-alive>
</template>

<script>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import System from './System.vue';
import Admin from './Admin.vue';

export default {
  name: 'App',
  components: {
    System,
    Admin,
  },
  setup() {
    const route = useRoute();

    // 根据当前路径判断是否为 /admin 路由
    const isAdminRoute = computed(() => route.path.startsWith('/admin'));

    return { isAdminRoute };
  },
};
</script>
